home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Resizer / Misc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-06  |  1.6 KB  |  56 lines

  1. /* 
  2.  *  misc.h   - Original code from Avery Lee's Virtual Dub
  3.  *
  4.  *    Copyright (C) Alberto Vigata - ultraflask@yahoo.com - January 2000
  5.  *
  6.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  7.  *    
  8.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  FlasKMPEG is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23.  
  24.  
  25. #ifndef f_VIRTUALDUB_MISC_H
  26. #define f_VIRTUALDUB_MISC_H
  27.  
  28. #include <mmsystem.h>
  29. long __declspec(naked) MulDivTrunc(long a, long b, long c) {
  30.     __asm {
  31.         mov eax,[esp+4]
  32.         imul dword ptr [esp+8]
  33.         idiv dword ptr [esp+12]
  34.         ret
  35.     }
  36. }
  37. int NearestLongValue(long v, const long *array, int array_size);
  38.  
  39. // only works properly when d1,d2>0!!
  40.  
  41. long inline int64divto32(__int64 d1, __int64 d2) {
  42.     return d2?(long)((d1+d2/2)/d2):0;
  43. }
  44.  
  45. __int64 inline int64divround(__int64 d1, __int64 d2) {
  46.     return d2?((d1+d2/2)/d2):0;
  47. }
  48.  
  49. __int64 inline int64divroundup(__int64 d1, __int64 d2) {
  50.     return d2?((d1+d2-1)/d2):0;
  51. }
  52.  
  53. bool isEqualFOURCC(FOURCC fccA, FOURCC fccB);
  54.  
  55. #endif
  56.